
#pragma once

#include <AVUIListBox.h>

namespace AVUI {

class ViewBase;

class ListView : public ListBox
{

public:
    ListView();
    ~ListView() { };

    DECLARE_ELEMENT(ListView, ListBox);

    DECLARE_DEPENDENCY_PROPERTY(View);
    TRefCountedPtr<ViewBase> get_View() { return (ViewBase*)(Object*)GetValue(get_ViewProperty()); }
    void set_View(ViewBase* pValue) { SetValue(get_ViewProperty(), (Object*)pValue); } 

protected:

    virtual bool IsItemItsOwnContainerOverride(Object* pItem);
    virtual TRefCountedPtr<DependencyObject> GetContainerForItemOverride();
    virtual void PrepareContainerForItemOverride(DependencyObject* pElement, Object* pItem);

private:
    static void StaticConstructor();

    void ApplyNewView();
    static void OnViewChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* args);

    ViewBase* m_pPreviousView;

};

 


}; // namespace AVUI



